<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义指令</title>
</head>
<body>
    <fieldset>
        <legend>
            自定义指令
        </legend>
        <fieldset>
            <legend>自定义一个v-focus指令</legend>
            <div id="app1">
                <input type="text" v-focus>
            </div>
        </fieldset>

    </fieldset>
</body>
</html>
<script src="node_modules/vue/dist/vue.js"></script>
<script type="text/javascript">
    //注册自定义指令
    Vue.directive("focus",{
        inserted:function (el) {
            el.focus();//让元素获取鼠标焦点
        }
    });

    var app1 = new Vue({
        el:"#app1"
    });

</script>